package main

import (
	"dianping_sol/api"
	"dianping_sol/config"
	"dianping_sol/db"
	"dianping_sol/spiders"
	"fmt"
	"github.com/gin-gonic/gin"
)

func init() {
	config.InitConfig()
	db.G_DB = db.InitMysql()
	if err := spiders.InitGR(config.Conf.DianPing.BaseUrl, "ch10"); err != nil {
		panic(err)
	}
	fmt.Println(`init success...`)

}

func main() {
	go spiders.StartWork(config.Conf.DianPing.BaseUrl)
	r := gin.Default()
	r.GET(`getshopinfo`, api.GetShopInfo)
	r.Run(config.Conf.Server.Addr)
}
